package com.bootdo.system.service.impl;

import com.bootdo.system.dao.JiaoyijiluDao;
import com.bootdo.system.domain.*;
import com.bootdo.system.service.JiaoyijiluService;
import com.sun.org.apache.bcel.internal.generic.RET;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;


@Service
public class JiaoyijiluServiceImpl implements JiaoyijiluService {
	@Autowired
	private JiaoyijiluDao jiaoyijiluDao;
	
	@Override
	public JiaoyijiluDO get(Long id){
		return jiaoyijiluDao.get(id);
	}
	
	@Override
	public List<JiaoyijiluDO> list(Map<String, Object> map){
		return jiaoyijiluDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return jiaoyijiluDao.count(map);
	}
	
	@Override
	public int save(JiaoyijiluDO jiaoyijilu){
		//


		//按照原价保存
		return jiaoyijiluDao.save(jiaoyijilu);
	}
	
	@Override
	public int update(JiaoyijiluDO jiaoyijilu){
		return jiaoyijiluDao.update(jiaoyijilu);
	}
	
	@Override
	public int remove(Long id){
		return jiaoyijiluDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return jiaoyijiluDao.batchRemove(ids);
	}

    @Override
    public List<JiaoyijiluDO> UserList(FormVO formVO) {


		return jiaoyijiluDao.UserList(formVO);
    }

    @Override
    public List<JiaoyijiluDO> UserListWithBizhongid(Long userId, Integer bizhongid) {


		return jiaoyijiluDao.UserListWithBizhongid(userId, bizhongid);
    }

    @Override
    public BigDecimal getTodayYingli(Long userId) {

		return jiaoyijiluDao.getTodayYingli(userId);
    }

	@Override
	public BigDecimal getAllYingli(Long userId) {
		return jiaoyijiluDao.getAllYingli(userId);
	}

    @Override
    public JiaoyijiluDO getMairuPriceByUidAndBid(Long userid, Integer bizhongid) {

		return jiaoyijiluDao.getMairuPriceByUidAndBid(userid, bizhongid);
    }

    @Override
    public void savejilu(Long userid, String orderno, BigDecimal xiadanshuliang, BigDecimal xiadanxianjia, Integer bucangcishu, BizhongDO bizhongDO, int jiaoyitype, String clientOrderId) {
		JiaoyijiluDO jiaoyijiluDO = new JiaoyijiluDO();
		jiaoyijiluDO.setUserid(userid);
		jiaoyijiluDO.setOrderno(orderno);
		jiaoyijiluDO.setXiadanshuliang(xiadanshuliang);
		jiaoyijiluDO.setXiadanxianjia(xiadanxianjia.toString());
		jiaoyijiluDO.setBucangcishu(bucangcishu);
		jiaoyijiluDO.setBizhongid(bizhongDO.getId());
		jiaoyijiluDO.setBizhongname(bizhongDO.getBizhongname());
		jiaoyijiluDO.setCreatetime(new Date());
		jiaoyijiluDO.setBeizhu(clientOrderId);
		jiaoyijiluDO.setJiaoyitype(jiaoyitype+"");
		jiaoyijiluDO.setPingtai("火币");

		jiaoyijiluDao.save(jiaoyijiluDO);

	}

	@Override
	public JiaoyijiluDO getByBeizhu(String beizhu) {
		return jiaoyijiluDao.getByBeizhu( beizhu);
	}

	@Override
	public List<DayYingli> everydayYinli(Long userId) {




		return jiaoyijiluDao.everydayyingli(userId);
	}

	@Override
	public BigDecimal getYestdayYingli(Long userid) {
		return jiaoyijiluDao.getYestdayYingli(userid);
	}

    @Override
    public BigDecimal getTodaytuiguangYingli(Long parentId) {

		return jiaoyijiluDao.getTodaytuiguangYingli( parentId);
    }

	@Override
	public BigDecimal getAlltuiguangYingli(Long parentId) {
		return jiaoyijiluDao.getAlltuiguangYingli( parentId);
	}

	@Override
	public List<JiaoyijiluDO> UserListAPI(FormVO formVO) {


		return  jiaoyijiluDao.UserListAPI(formVO);
	}

    @Override
    public List<JiaoyijiluDO> bizhongjilu(Long userId, Long bizhongid) {

		return jiaoyijiluDao.bizhongjilu( userId,  bizhongid);
    }

}
